package com.ruoyi.develop.projectFeeInfo.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.projectFeeInfo.mapper.ProjectFeeInfoMapper;
import com.ruoyi.develop.projectFeeInfo.domain.ProjectFeeInfo;
import com.ruoyi.develop.projectFeeInfo.service.IProjectFeeInfoService;

/**
 * 项目研发经费Service业务层处理
 * @author qh
 * @date 2023-01-10
 */
@Service
public class ProjectFeeInfoServiceImpl implements IProjectFeeInfoService {
    @Resource
    private ProjectFeeInfoMapper projectFeeInfoMapper;

    /**
     * 查询项目研发经费
     * @param id 项目研发经费主键
     * @return 项目研发经费
     */
    @Override
    public ProjectFeeInfo selectById(String id) {
        return projectFeeInfoMapper.selectById(id);
    }

    /**
     * 查询项目研发经费列表
     * @param entity 项目研发经费
     * @return 项目研发经费
     */
    @Override
    public List<ProjectFeeInfo> selectList(ProjectFeeInfo entity) {
        return projectFeeInfoMapper.selectList(entity);
    }

    /**
     * 新增项目研发经费
     * @param entity 项目研发经费
     * @return 结果
     */
    @Override
    public int insert(ProjectFeeInfo entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return projectFeeInfoMapper.insert(entity);
    }

    /**
     * 修改项目研发经费
     * @param entity 项目研发经费
     * @return 结果
     */
    @Override
    public int update(ProjectFeeInfo entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return projectFeeInfoMapper.update(entity);
    }

    /**
     * 批量删除项目研发经费
     * @param ids 需要删除的项目研发经费主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return projectFeeInfoMapper.deleteByIds(ids);
    }

    /**
     * 删除项目研发经费信息
     * @param id 项目研发经费主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return projectFeeInfoMapper.deleteById(id);
    }
}
